<script>
import Vue from 'vue';
export default {
	onLaunch: function() {
		// #ifdef H5
		if (window.location.hash != '') {
			let search = window.location.search.substring(1);
			try {
				if (search.indexOf('hashpath') != -1) {
					let sea = JSON.parse(
						'{"' +
							decodeURIComponent(search)
								.replace(/"/g, '\\"')
								.replace(/&/g, '","')
								.replace(/=/g, '":"') +
							'"}'
					);
					if (sea.hashpath && sea.code && sea.state) {
						let order_id = sea.order_id || '';
						window.location.href =
							window.location.origin +
							window.location.pathname +
							'#' +
							sea.hashpath +
							'?code=' +
							sea.code +
							'&state=' +
							sea.state +
							'&order_id=' +
							order_id;
					}
				}
			} catch (e) {
				//TODO handle the exception
			}
		}
		// #endif
	},
	onShow: function() {
		this.$api.getSetting().then(res => {
			if (res.code) {
				this.$vuex('vuex_config', res.data);
			}
		});
	},
	onHide: function() {
		console.log('App Hide');
	}
};
</script>

<style>
@import 'colorui/main.css';
@import 'colorui/icon.css';
</style>
